package com.zy.server.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.zy.mapper.UserMapper;
import com.zy.pojo.User;
import com.zy.server.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author: 11473
 * @time: 2019/9/27 16:24
 */
@Service
public class UserServiceImpl implements UserService {

    @Autowired
    UserMapper userMapper;

    /**
     * 分页查询
     * @param pageIndex 数据的起始位置
     * @param pageSize 一次查询数据的大小
     * @return
     */
    @Override
    public PageInfo<User> select(int pageIndex, int pageSize) {
        PageHelper.startPage(pageIndex,pageSize);
        List<User> user = userMapper.select();
        PageInfo<User> pageUser = new PageInfo<>(user);
        return pageUser;
    }
}
